class Namespace {
  final String id;
  final String name;
  final int permission;

  Namespace({
    required this.id,
    required this.name,
    required this.permission,
  });

  factory Namespace.fromJson(Map<String, dynamic> json) {
    return Namespace(
      id: json['id'].toString(),
      name: json['name'] as String,
      permission: json['permission'] as int,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'permission': permission,
    };
  }

  /// 是否为私有空间
  bool get isPrivate => permission == 0;
}
